<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://www.springframework.org/security/tags"
	prefix="security"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>增加房产信息</title>
<LINK href="images/css.css" type="text/css" rel="stylesheet">
<style type="text/css">
<!--
.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	color: #707070;
	font-size: 12px;
}

.STYLE5 {
	color: #0a6e0c;
	font-size: 12px;
}

body {
	margin-top: 0px;
	margin-bottom: 0px;
}

.STYLE7 {
	font-size: 12
}
-->
</style>
<script type="text/javascript">
	function checkForm() {
		var buildingId = document.forms[0].buildingId.value;
		var name = document.forms[0].name.value;
		var typeId = document.forms[0].typeId.value;
		var floorCount = document.forms[0].floorCount.value;
		var subDistrictId = document.forms[0].subDistrictId.value;

		if (buildingId == null || buildingId == "") {
			alert("请输入楼栋编号！");
			return false;
		} else if (buildingId.length!=2) {
			alert("请输入2位楼栋编号！");
			return false;
		}
		if (name == null || name == "") {
			alert("请输入楼栋名称！");
			return false;
		}
		if (typeId == 0) {
			alert("请选择楼栋类型！");
			return false;
		}
		if (floorCount == 0) {
			alert("请输入楼栋层数！");
			return false;
		}
		if (subDistrictId == 0) {
			alert("请输入所属管理区！");
			return false;
		}
		return true;
	}
</script>
</head>

<body>
<table class="tableline" cellspacing="1" cellpadding="0" width="100%"
	border="0">
	<html:form action="building.do?method=save" method="post"
		onsubmit="return checkForm();">
		<tr>
			<td class="STYLE4" align="center" bgcolor="#ffffff" colspan="2"
				height="40">添加楼栋</td>
		</tr>
		<tr>
			<td width="217" height="26" align="right" bgcolor="#ffffff">楼栋编号:</td>
			<td width="773" bgcolor="#ffffff"><label for="textfield"></label>
			&nbsp;<html:text property="buildingId" />&nbsp;&nbsp;<span style="color:#5f9c12;">请输入2位数字，例如01</span> 
			<font color="red">${buildingIdError}${buildingIdRequest }</font></td>
		</tr>
		<tr>
			<td height="26" align="right" bgcolor="#ffffff">楼栋名称:</td>
			<td bgcolor="#ffffff">&nbsp;<html:text property="name" />
			<font color="red">${buildingNameError }</font></td>
		</tr>
		<tr>
			<td width="217" height="26" align="right" bgcolor="#ffffff">楼栋类型:</td>
			<td width="773" bgcolor="#ffffff">&nbsp;<html:select property="typeId" style="width:155px">
				<html:option value="0">请选择</html:option>
				<c:if test="${!empty typesList}">
					<c:forEach items="${typesList}" var="type">
						<html:option value="${type.id}">${type.name}</html:option>
					</c:forEach>
				</c:if>
			</html:select>&nbsp;<font color="red">${buildingTypeError }</font></td>
		</tr>
		<tr>
			<td width="217" height="26" align="right" bgcolor="#ffffff">楼栋层数:</td>
			<td width="773" bgcolor="#ffffff"><label for="textfield"></label>
			&nbsp;<html:text property="floorCount" /> <font color="red">${buildingFloorCountError
			}</font></td>
		</tr>
		<tr>
			<td width="217" height="26" align="right" bgcolor="#ffffff">所属小区:</td>
			<td width="773" bgcolor="#ffffff"><label for="textfield"></label>
			&nbsp;<html:select property="subDistrictId" style="width:155px">
				<html:option value="0">请选择</html:option>
				<c:if test="${!empty subDistrictList}">
					<c:forEach items="${subDistrictList}" var="subDistrict">
						<html:option value="${subDistrict.id}">${subDistrict.name}</html:option>
					</c:forEach>
				</c:if>
			</html:select>&nbsp;&nbsp;<html:submit value="增加楼栋" /> <font color="red">${subDistrictIdError	}</font></td>
		</tr>
	</html:form>
</table>
</body>
</html>